<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<title></title>
		<link rel="stylesheet" href="../../css/font.css" />
		<link rel="stylesheet" href="../../css/common.css" />
		<link rel="stylesheet" href="../../css/user.css" />
		<script type="text/javascript">
			document.addEventListener('plusready', function() {
				//console.log("所有plus api都应该在此事件发生后调用，否则会出现plus is undefined。"

			});
		</script>

	</head>
	<body>
		<header class=" header-module ">
			<div class="flex-justify-align header-top">
				<a href="../../setting.html" class="iconfont iconfanhuijiantou header-back"></a>
				<p class="header-title">修改密码</p>
				<span class="header-span"></span>
			</div>

		</header>
		<article class="middle-moudle">
			<section class="base-interval user-module ">
				<form id="loginInfo">
					<input type="hidden" name="id" id="id">
					<div class="user-item">
						<p>原始密码</p>
						<input type="text" name="password">
					</div>
					<div class="user-item">
						<p>新密码</p>
						<input type="password" name="newPwd1">
					</div>
					<div class="user-item">
						<p>新密码</p>
						<input type="password" name="newPwd2">
					</div>
					<div class="user-item">
						<button type="button" class="user-btn" onclick="changePassword()">修改</button>
					</div>
				</form>
			</section>
		</article>
	</body>
	<script src="../../js/jquery-3.0.0.min.js"></script>
	<script src="../../js/gloab.js"></script>

	<script>
		$(function() {
			var company = JSON.parse(localStorage.getItem("company"));
			var id = company.id;
			$("#id").val(id);
		});

		function changePassword() {
			$.ajax({
				//请求方式    
				type: "GET",
				//文件位置    
				url: basePath+"app/tcompany/changePassword",
				data: $("#loginInfo").serialize(),
				//返回数据格式为json,也可以是其他格式如    
				dataType: "json",
				//请求成功拼接html    
				success: function(data) {
					console.log(data);
					if(data.code == 0){
						alert("修改成功");
						window.location.href="/app/setting.html";
					}else{
						alert(data.msg);
					}
				}
			});
		};
		
		//获取url中的参数
		function getUrlParam(name) {
			var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
			var r = window.location.search.substr(1).match(reg); //匹配目标参数
			if (r != null) return unescape(r[2]);
			return null; //返回参数值
		}
	</script>
</html>
